<!-- 明星教室 -->
<template>
  <div class="star">
    <!-- 头部 -->
    <div>
      <cnp>
        <h1>明星教师</h1>
      </cnp>
      <el-button type="primary" icon="el-icon-s-promotion" class="fanhui">
        <router-link to="/Star" >返回</router-link>
      </el-button>
    </div>
    <!-- 内容区域 -->
    <div class="star-cont">
      <!-- 筛选区域 -->
      <saixuan class="sx">
        <el-input placeholder="输入教师的姓名......" v-model="inpval" clearable></el-input>
      </saixuan>
      <!-- 板块的内容区域 -->
      <div class="lb-wrap">
        <!-- 标题部分 -->
        <div class="lb-title">
          <div class="lb-title-left">
            <img src="../assets/h1.png" alt />
            <span>文章列表</span>
          </div>
        </div>
        <!-- 主要内容部分 -->
        <div class="lb-content">
          <div class="lb-content-head">
            <ul>
              <li></li>
              <li>教师姓名</li>
              <li>教师头像</li>
              <li>职位</li>
              <li>上传人</li>
              <li>上传时间</li>
              <li>上传操作</li>
            </ul>
          </div>
          <div class="lb-content-con">
            <div class="con-wrap" v-for="(item,index)  in list" :key="item.id">
              <div class="inp">
                <input type="checkbox" @click="danCiick(index)" :checked="item.isShow" />
              </div>
              <p>{{item.name}}</p>
              <div class="tp1">
                <img src="../assets/con1.png" alt />
              </div>
              <span>{{item.name1}}</span>
              <em>{{item.zw}}</em>
              <strong>{{item.time}}</strong>
              <div class="btn">
                <el-button :plain="true" @click="open2(index)" type="text">{{item.cz1}}</el-button>
                <el-button type="text" @click="open(index)">{{item.cz2}}</el-button>
              </div>
            </div>
          </div>
        </div>
        <!-- 底部部分 -->
        <div class="star-footer">
          <div class="star-input">
            <input type="checkbox" :checked="allCheck1" @click.stop="allCheckbox" />
            <span>全选</span>
            <em @click="plsc">批量彻底删除</em>
          </div>
          <div class="fyq">
            <template>
              <div class="block">
                <el-pagination
                  :background="true"
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage4"
                  :page-sizes="[10, 20, 30, 40]"
                  :page-size="100"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="100"
                ></el-pagination>
              </div>
            </template>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import cnp from "../components/biaoti";
import saixuan from "../components/saixuan";
export default {
  name: "huishou",
  data() {
    return {
      inpval: "",
      list: [
        {
          id: 11,
          name: "Json",
          img: "",
          zw: "英语外教",
          name1: "Daisy",
          time: "2010-01-25 10:55",
          cz1: "恢复",
          cz2: "彻底删除",
          isShow: false,
        },
        {
          id: 12,
          name: "Json",
          img: "",
          zw: "英语外教",
          name1: "Daisy",
          time: "2010-01-25 10:55",
          cz1: "恢复",
          cz2: "彻底删除",
          isShow: false,
        }
      ],
      allCheck1: false,
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      params: "",
    };
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    // 恢复数据
    open2(index) {
      this.$message({
        message: "恢复成功",
        type: "success",
      });
    },
    // 删除数据
    open(index) {
      this.$confirm("删除后恢复，确定删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          this.huancun = this.list[index];
          this.list.splice(index, 1);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //全选
    allCheckbox: function () {
      this.list.forEach((v) => {
        v.isShow = !this.allCheck1;
      });
      this.allCheck1 = !this.allCheck1;
    },
    // 单选
    danCiick(index) {
      this.list[index].isShow = !this.list[index].isShow;
      let bool = this.list.every((item) => {
        return item.isShow == true;
      });
      if (bool) {
        this.allCheck1 = bool;
      } else {
        this.allCheck1 = bool;
      }
    },
    plsc() {
      let cood = this.list.filter((v) => {
        return !v.isShow;
      });
      this.list = cood;
    },
  },
  components: {
    cnp,
    saixuan,
  },
  mounted() {
    this.params = JSON.parse(localStorage.getItem("params"));
    this.params.forEach(v=>{
      v.cz1='恢复'
      v.cz2='彻底删除'
      this.list.push(v)
    })
  },
};
</script>

<style scoped>
em {
  font-style: normal;
}
strong {
  font-weight: normal;
}
.star {
  position: relative;
  width: 1140px;
  margin: 0 auto;
}
.lb-wrap {
  margin: 0 auto;
  width: 1100px;
  min-height: 310px;
  border: 1px solid #eeeeee;
  margin-top: 10px;
  padding: 0 20px;
}
.lb-title {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lb-title-left {
  display: flex;
  position: relative;
  padding-top: 16px;
}
.lb-title-left img {
  display: block;
  width: 17px;
  height: 14px;
}
.lb-title-left span {
  font-size: 14px;
  color: #666;
  position: relative;
  left: 4px;
  top: -3px;
}

.lb-title-right .el-button {
  position: relative;
  background: #fff;
}

.lb-title-right {
  padding-top: 12px;
}
#router-span1 {
  font-size: 12px;
  position: absolute;
  right: 8px;
  top: 10px;
  color: #a760f6;
}
.el-icon-circle-plus-outline {
  position: absolute;
  left: 10px;
  top: 7px;
}
#router-span2 {
  font-size: 12px;
  position: absolute;
  right: 18px;
  top: 10px;
  color: #a760f6;
}
.el-icon-delete {
  position: absolute;
  left: 16px;
  top: 7px;
}
/* 内容的开始 */
.lb-content {
  width: 100%;
  margin-top: 10px;
}
.lb-content-head {
  width: 1058px;
  height: 60px;
  background-color: #a760f6;
  display: flex;
  justify-content: space-around;
  align-items: center;
  line-height: 60px;
  color: #fff;
  font-size: 14px;
  font-family: "思源黑体 Bold", "思源黑体 Regular", "思源黑体";
  font-weight: 700;
  font-style: normal;
}
.lb-content-head li {
  float: left;
}
li {
  height: 100%;
  list-style: none;
  text-align: center;
}
li:nth-child(1) {
  width: 80px;
  height: 60px;
}
li:nth-child(2),
li:nth-child(3),
.con-wrap p,
.con-wrap .tp1 {
  width: 153px;
}
.tp1 img {
  margin-top: 18px;
}
li:nth-child(4),
li:nth-child(7),
.con-wrap span,
.con-wrap .btn {
  width: 192px;
}
.con-wrap .btn .el-button {
  font-size: 12px;
}
li:nth-child(5),
.con-wrap em {
  width: 162px;
}
li:nth-child(6),
.con-wrap strong {
  width: 118px;
}
.con-wrap {
  display: flex;
  height: 90px;
  border: 1px solid #ccc;
  line-height: 90px;
  text-align: center;
  font-size: 12px;
}
.inp {
  width: 80px;
}
.con-wrap .el-button {
  color: #a760f6;
}
.con-wrap .el-button:hover {
  border: 1px solid transparent;
}
.star-footer {
  height: 100px;
  width: 100%;
  line-height: 100px;
  margin-top: 10px;
}
.star-input {
  float: left;
  margin-left: 33px;
}
.star-input input {
  margin-right: 8px;
}
.star-input em {
  margin-left: 10px;
  color: #999999;
  font-size: 14px;
}
.fyq {
  margin-top: 34px;
  float: right;
}
.fanhui {
  position: absolute;
  right: 18px;
  background: #a760f6;
  top: 14px;
}
.fanhui a {
  color: #fff;
  text-decoration: none;
}
</style>